package kni.hoid;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TabHost;
import android.widget.Toast;

public class KnihoidTabWidget extends TabActivity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Resources res = getResources(); // Resource object to get Drawables
		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Resusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, SearchActivity.class);

		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("search")
				.setIndicator("Hledat", res.getDrawable(R.drawable.search))
				.setContent(intent);
		tabHost.addTab(spec);

		// Do the same for the other tabs
		intent = new Intent().setClass(this, BarcodeActivity.class);
		final Intent in = new Intent("com.google.zxing.client.android.SCAN");
		in.putExtra("SCAN_MODE", "ONE_D_MODE");
		spec = tabHost.newTabSpec("albums")
				.setIndicator("Čárák", res.getDrawable(R.drawable.scanner))
				.setContent(intent);

		tabHost.addTab(spec);
		// tabHost.setOnClickListener(new OnClickListener() {
		//
		// public void onClick(View v) {
		// startActivityForResult(in, 0);
		// }
		// });

		intent = new Intent().setClass(this, NavigateActivity.class);
		spec = tabHost.newTabSpec("songs")
				.setIndicator("Do MZK", res.getDrawable(R.drawable.navigate))
				.setContent(intent);
		tabHost.addTab(spec);

		intent = new Intent().setClass(this, HelpActivity.class);
		spec = tabHost.newTabSpec("help")
				.setIndicator("Nápověda", res.getDrawable(R.drawable.help))
				.setContent(intent);
		tabHost.addTab(spec);
		tabHost.setCurrentTab(0);
	}
}
